package com.ypc.user2.config.rabbit;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitMQConfig {

    @Bean
    public Queue testQueue(){
        return new Queue("TestQueue",true);
    }

    @Bean
    public Queue testQueue1(){
        return new Queue("TestQueue1",true);
    }
    @Bean
    public Queue testQueue2(){
        return new Queue("TestQueue2",true);
    }
    @Bean
    public Queue testQueue3(){
        return new Queue("TestQueue3",true);
    }
    @Bean
    public Queue testQueue4(){
        return new Queue("TestQueue4",true);
    }



    @Bean
    public DirectExchange testDirectExchange(){
        return new DirectExchange("TestDirectExchange");
    }

    @Bean
    public TopicExchange topicExchange(){ return new TopicExchange("TopicExchange");}

    @Bean
    Binding bindingDirect() {
        return BindingBuilder.bind(testQueue()).to(testDirectExchange()).with("TestDirectRouting");
    }

    @Bean
    Binding bindingTopic(){
        return BindingBuilder.bind(testQueue1()).to(topicExchange()).with("TestTopicRouting");
    }

    @Bean
    DirectExchange lonelyDirectExchange() {
        return new DirectExchange("lonelyDirectExchange");
    }

}

